#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
#include <QDateTime>
#include <QApplication>
#include <QClipboard>
#include <QDebug>
#include <QLineEdit>
#include <QLabel>
#include <QStringList>
#include <QMap>
#include <QFile>
#include <QFileDialog>

#include "checkfiletask.h"

enum {
    MD5_32,
    SHA_1,
    SHA_256,
    SHA_384,
    SHA_512,

    DIGEST_BUTT
};

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    
private slots:
    void onTimeout();
    void onTipsChange();
    void onTimestamp2Time();
    void onTime2Timestamp();
    void onDigestChange();
    void onDigestSrcChange();
    void setClipboard(QString text);

    void onBase64Encode();
    void onBase64Decode();

    void notifyResult(int result, QString error, QString type, QString digest);

    void onOpenFile();
    void onStartCheckFile();
    void onFileProcess(int read, int total);

private:
    Ui::MainWindow *ui;

    bool digestSrcChanged;

    QTimer timer;
    QTimer timer4tips;
    QTimer timer4digest;
    QLabel tips;
    QLabel info;
    QStringList tipList;
    QMap<int, QString> digestMap;

    CheckFileTask task;
};

#endif // MAINWINDOW_H
